package com.hotelsystem.service.impl;

import com.hotelsystem.dao.RoleMapper;
import com.hotelsystem.pojo.Role;
import com.hotelsystem.service.RoleService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;


@Service(value = "roleServiceImpl")
public class RoleServiceImpl implements RoleService {

    @Resource
    private RoleMapper roleMapper;

//    @Resource
//    private RedisTemplate<Object,Object> redisTemplate;


    @Transactional(readOnly = true,propagation = Propagation.SUPPORTS)
    @Override
    public List<Role> getAllRoleInfo() throws Exception {
//        Object getAllRoleInfo = redisTemplate.opsForValue().get("getAllRoleLists");
//        if (getAllRoleInfo == null){
        List<Role>  getAllRoleInfo = roleMapper.getAllRoleInfo();
//            redisTemplate.opsForValue().set("getAllRoleLists",getAllRoleInfo);
//        }
        return  getAllRoleInfo;
    }
}
